<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
	//echo (date('Y-m-d H:i:s'));
    //return view('welcome');
	//echo Config::set('app.local','cn');
	//获取时区
	//echo Config::get('app.timezone');
	//获取自定义
	//echo Config::get('app.webname');
	//设置
	//echo Config::set('app.key','aaaaaaa');
	//获取设置的内容
	//echo Config::get('app.key');
			
	
});
Route::get('/test',function(){
	
	return view('form');
});

Route::post('/post',function(){
	var_dump($_POST);
});
//创建一个带参数的get
// Route::get('/user/delete/{id}',function($id){
// 	echo '我的ID为'.$id;
// })->where('id','[0-9]+');
//创建一个带多参数的get
Route::get('/user/insert/{id}-{name}',function($id,$name){
	echo '删除的ID为'.$id.'删除的名称为'.$name;
})->where('id','[0-9]+')->where('name','[a-zA-Z]+');
//创建一个带别名的路由
Route::get('/admin/order/delete/{id}',['as'=>'od','uses'=>function($id){
	echo '这是后台订单的删除操作，删除id为：'.$id.'<br>';
	//获取url
	echo route('od');
}]);
//创建一组路由
Route::group(['middleware'=>'login'],function(){
	Route::get('/admin/user',function(){
		echo '这是用户的后台';
	});
	Route::get('/admin/goods',function(){
		echo '这是商品的后台';
	});
	Route::get('/admin/order',function(){
		echo '这是订单的后台';
	});
});

	Route::get('/login',function(){
		echo '这是登录页面';
	});
	Route::get('/user/login',function(){

	})->middleware('login');
	//创建一条ajax请求路由
	Route::get('/ajax',function(){
		return view('ajax');
	});
	Route::get('/getInfo',function(){
		echo '这是一个ajax的get请求';
	});
	Route::post('/getInfo',function(){
		echo '这是一个ajax的post请求';
	});
	//创建一个控制器的请求
	// Route::get('user/index','UserController@index');
	// Route::get('user/add','UserController@add');
	// Route::get('user/insert','UserController@insert');
	// Route::get('user/edit/{id}','UserController@edit');
	// Route::get('user/delete','UserController@delete');
	//隐式路由
	Route::controller('/goods','GoodsController');
	Route::controller('/test','TestController');
	Route::controller('/response','ResponseController');
	Route::controller('/db','Admin\DbController');
	Route::controller('/user','Admin\UserController');
